//
//  NovelHorizontalTableViewCell.m
//  WuLi
//
//  Created by Gollum on 16/9/24.
//  Copyright © 2016年 Gollum. All rights reserved.
//

#import "NovelHorizontalTableViewCell.h"
#import "NovelHorizontalCollectionViewCell.h"

#define kNovelHorizontalCollectionViewCellReuse @"NovelHorizontalCollectionViewCellReuse"
@interface NovelHorizontalTableViewCell()<UICollectionViewDataSource,UICollectionViewDelegate>



@end

@implementation NovelHorizontalTableViewCell

- (void)awakeFromNib {
    // Initialization code
    //布局
    UICollectionViewFlowLayout * flowLayout = [[UICollectionViewFlowLayout alloc] init];
    flowLayout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
    flowLayout.minimumInteritemSpacing = 0;
    flowLayout.minimumLineSpacing = 0;
    
    [self.collectionView setCollectionViewLayout:flowLayout];
    //注册（xib）
    
    
    UINib *nib = [UINib nibWithNibName:@"NovelHorizontalCollectionViewCell" bundle:[NSBundle mainBundle]];
    _collectionView.delegate = self;
    _collectionView.dataSource = self;
    _collectionView.bounces = NO;
    _collectionView.scrollEnabled = NO;
    _collectionView.userInteractionEnabled = YES;
    [self.collectionView registerNib:nib forCellWithReuseIdentifier:kNovelHorizontalCollectionViewCellReuse];
}





- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{


    return 6;

}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

    NovelHorizontalCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:kNovelHorizontalCollectionViewCellReuse forIndexPath:indexPath];
    
    return cell;


}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    return CGSizeMake([UIScreen mainScreen].bounds.size.width / 2, [UIScreen mainScreen].bounds.size.width / 2 * 0.8 );
    
}





- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
